home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / AppleScript / Scripts / creator2MPS / creator2MPS < prev   
Encoding:
Text File  |  1994-05-07  |  2.1 KB  |  58 lines  |  [TEXT/R*ch]

  1. -- Creator to MPS 
  2. -- Droplet to change file creator to MPS .
  3. -- Requires "Progress Bar", "Finder Liaison", "String Commands"
  4. -- from The Tao of AppleScript
  5. -- January 1994 by Dale M. Greer
  6.  
  7. on open (docList)
  8.   -- The Progress Bar stuff can be eliminated if you don't care for it
  9.   set counter to (number of items in docList)
  10.   
  11.   tell application "Progress Bar 1.0"
  12.     make window
  13.     tell window 1
  14.       set the Name to "Creator to MPS "
  15.       set the minimum value of progress bar 1 to 1
  16.       set the maximum value of progress bar 1 to counter
  17.       set the current value of progress bar 1 to counter
  18.       set the caption of progress bar 1 to "PreparingI" & (counter as string)
  19.       activate
  20.     end tell
  21.   end tell
  22.   
  23.   tell application "Finder Liaison 1.0"
  24.     repeat with tmp in docList
  25.       -- Note many "as string"s.
  26.       -- If you don't do this, AppleScript makes a list.  Headache!
  27.       copy tmp as string to temp
  28.       copy (characters 1 thru ((offset of ":" in temp) - 1) of temp)
  29.        as string to theDisk
  30.       copy (characters ((offset of ":" in temp) + 1) thru end of temp)
  31.        as string to temp
  32.       copy (characters 1 thru ((offset of ":" in temp) - 1) of temp)
  33.        as string to theFolder
  34.       copy (characters ((offset of ":" in temp) + 1) thru end of temp)
  35.        as string to theFile
  36.       copy (Get Type of File (theFile as string) of Folder theFolder
  37.        of Disk theDisk) to fileType -- Finder Liaison command
  38.  
  39.       if fileType is "TEXT" then
  40.         tell window 1 of application "Progress Bar 1.0"
  41.           set the caption of progress bar 1 to "Changing creator of:"
  42.           set the subcaption of progress bar 1 to theFile
  43.         end tell
  44.  
  45.         Set Creator of File (theFile as string) of Folder theFolder
  46.          of Disk theDisk to "MPS " -- Finder Liaison command
  47.       end if
  48.  
  49.       tell window 1 of application "Progress Bar 1.0" to set the current value
  50.        of progress bar 1 to counter
  51.       set counter to counter - 1
  52.     end repeat
  53.   end tell
  54.   
  55.   tell application "Finder Liaison 1.0" to quit
  56.   tell application "Progress Bar 1.0" to quit
  57. end open
  58.